package com.swallowtech.mstation.core.repository.mybatis;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.swallowtech.mstation.common.Repository.AbstractBaseRepository;
import com.swallowtech.mstation.core.domain.Tag;
import com.swallowtech.mstation.core.repository.TagRepository;

@Repository
public class TagRepositoryImpl extends AbstractBaseRepository implements TagRepository {
	@Autowired
	private TagMapper tagMapper;
	
	public Tag findByPrimaryKey(String pk) {
		return tagMapper.selectByPrimaryKey(pk);
	}	
	
	public Tag findByPrimaryKey(Tag entity) {
		return findByPrimaryKey(entity.getId());
	}

	public Collection<Tag> findAll() {
		throw new UnsupportedOperationException();
	}
	
	public int insert(Tag entity) {
		return tagMapper.insert(entity);
	}

	public int update(Tag entity) {
		return tagMapper.update(entity);
	}
	

	public int updateIgnoreNull(Tag entity) {
		return tagMapper.updateIgnoreNull(entity);
	}	

	public int deleteByPrimaryKey(String pk) {
		return tagMapper.deleteByPrimaryKey(pk);
	}
	
	public int delete(Tag entity) {
		return deleteByPrimaryKey(entity.getId());
	}


}
